package com.pk.platform.business.charge.web;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.pk.platform.business.charge.service.IChargeIndexService;
import com.pk.platform.business.charge.service.IChargeTempService;
import com.pk.platform.business.charge.vo.ChargeTempVO;
import com.pk.platform.business.common.service.IChildService;
import com.pk.platform.business.common.service.IClaService;
import com.pk.platform.business.core.web.GenericAction;
import com.pk.platform.domain.charge.ChargeIndex;
import com.pk.platform.domain.charge.ChargeTemp;
import com.pk.platform.domain.common.Child;
import com.pk.platform.domain.common.Cla;
import com.pk.platform.domain.common.Kindergarten;
import com.pk.platform.util.DateConverter;
import com.pk.platform.util.SelectOption;

public class ChargeTempAction extends GenericAction {

	private IChargeTempService chargeTempService;
	
	private ChargeTemp ct = new ChargeTemp();
	
	private ChargeTempVO ctvo = new ChargeTempVO();
	
	private List<Cla> classList = new ArrayList<Cla>();
	
	private List<ChargeIndex> chargeIndexList = new ArrayList<ChargeIndex>();

	private IClaService claService;

	private IChargeIndexService chargeIndexService;
	
	private String[] cbIndex;
	
	private String sort;

	private String amount;

	private String quantityHidd;
	
	private List<Map<String, Object>> mapList = new ArrayList<Map<String,Object>>();
	
	private Child child = new Child();
	
	private Cla cla = new Cla();
	
	private IChildService childService;
	
	private List<SelectOption> monthList = new ArrayList<SelectOption>();
	
	public String chargeTempManage()
	{
		classList = claService.queryClassList(kindergartenId);
		ctvo.setKindergartenId(kindergartenId);
		lp = chargeTempService.queryChargeTemp(ctvo, pager);
		return SUCCESS;
	}

	public String toAddChargeTemp()
	{
		classList = claService.queryClassList(kindergartenId);
		chargeIndexList = chargeIndexService.queryChargeIndexList();
		return SUCCESS;
	}
	
	public String addChargeTemp()
	{
		Kindergarten k = new Kindergarten(kindergartenId); 
		ct.setKindergarten(k);
		chargeTempService.addChargeTemp(ct, cbIndex, sort, amount, quantityHidd);
		return SUCCESS;
	}
	
	public String toUpdateChargeTemp()
	{
		String chargeTempId = ct.getId();
		ct = chargeTempService.queryChargeTempById(chargeTempId);
		classList = claService.queryClassList(kindergartenId);
		chargeIndexList = chargeIndexService.queryChargeIndexList();
		mapList = chargeIndexService.queryHasSetChargeIndexList(chargeTempId);
		return SUCCESS;
	}
	
	public String updateChargeTemp()
	{
		chargeTempService.updateChargeTemp(ct, cbIndex, sort, amount, quantityHidd);
		return SUCCESS;
	}
	
	public String delChargeTemp()
	{
		chargeTempService.delChargeTemp(ct.getId());
		return SUCCESS;
	}
	
	public String toSelectChargeTemp()
	{
		child = childService.queryChildById(child.getId());
		cla = child.getCla();
		
		classList = claService.queryClassList(kindergartenId);
		ctvo.setKindergartenId(kindergartenId);
		lp = chargeTempService.queryChargeTemp(ctvo, pager);
		return SUCCESS;
	}

	public IChargeTempService getChargeTempService() {
		return chargeTempService;
	}

	public void setChargeTempService(IChargeTempService chargeTempService) {
		this.chargeTempService = chargeTempService;
	}

	public ChargeTemp getCt() {
		return ct;
	}

	public void setCt(ChargeTemp ct) {
		this.ct = ct;
	}

	public ChargeTempVO getCtvo() {
		return ctvo;
	}

	public void setCtvo(ChargeTempVO ctvo) {
		this.ctvo = ctvo;
	}

	public List<Cla> getClassList() {
		return classList;
	}

	public void setClassList(List<Cla> classList) {
		this.classList = classList;
	}

	public IClaService getClaService() {
		return claService;
	}

	public void setClaService(IClaService claService) {
		this.claService = claService;
	}

	public List<ChargeIndex> getChargeIndexList() {
		return chargeIndexList;
	}

	public void setChargeIndexList(List<ChargeIndex> chargeIndexList) {
		this.chargeIndexList = chargeIndexList;
	}

	public IChargeIndexService getChargeIndexService() {
		return chargeIndexService;
	}

	public void setChargeIndexService(IChargeIndexService chargeIndexService) {
		this.chargeIndexService = chargeIndexService;
	}

	public String[] getCbIndex() {
		return cbIndex;
	}

	public void setCbIndex(String[] cbIndex) {
		this.cbIndex = cbIndex;
	}

	public String getSort() {
		return sort;
	}

	public void setSort(String sort) {
		this.sort = sort;
	}

	public List<Map<String, Object>> getMapList() {
		return mapList;
	}

	public void setMapList(List<Map<String, Object>> mapList) {
		this.mapList = mapList;
	}

	public String getAmount() {
		return amount;
	}

	public void setAmount(String amount) {
		this.amount = amount;
	}

	public Child getChild() {
		return child;
	}

	public void setChild(Child child) {
		this.child = child;
	}

	public Cla getCla() {
		return cla;
	}

	public void setCla(Cla cla) {
		this.cla = cla;
	}

	public IChildService getChildService() {
		return childService;
	}

	public void setChildService(IChildService childService) {
		this.childService = childService;
	}

	public List<SelectOption> getMonthList() {
		return monthList;
	}

	public void setMonthList(List<SelectOption> monthList) {
		this.monthList = monthList;
	}

	public String getQuantityHidd() {
		return quantityHidd;
	}

	public void setQuantityHidd(String quantityHidd) {
		this.quantityHidd = quantityHidd;
	}

}
